package name.fowler.refactoring.simplestore;

class TextFormatter implements Formatter {
	private int width;

	public TextFormatter(int width) {
		this.width = width;
	}
	
	@Override
		public void header(String s) {
		println("New report: " + s + " **************************************************************\n");
	}

	@Override
		public void footer(String s) {
		println("+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------");
		println(" ### " + s + " ### ");
		println("+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------");
	}

	@Override
		public void println( String text ) {
		System.out.println(text.substring(0, Math.min(width, text.length())) + "\n");
	}
}
